import request from "@/utils/request";

class ActivityAPI {
  /**
   * 分页查询活动
   */
  static getPage(title: string, pageSize: number, pageNum: number) {
    return request<any, any>({
      url: "/api/activity/page",
      method: "post",
      data: {
        title,
        pageNum,
        pageSize
      },
    });
  }

  /**
   * 保存/更新活动
   */
  static save(activity: any) {
    return request<any, any>({
      url: "/api/activity/save",
      method: "post",
      data: activity,
    });
  }

  /**
   * 删除活动
   */
  static delete(id: number) {
    return request<any, any>({
      url: "/api/activity/delete",
      method: "post",
      data: { id },
    });
  }

  /**
   * 获取单个活动详情
   */
  static get(id: number) {
    return request<any, any>({
      url: "/api/activity/get",
      method: "post",
      data: { id },
    });
  }
}

export default ActivityAPI;
